home *** CD-ROM | disk | FTP | other *** search
/ Utilities Professional 1-1500 / Utilities Professional 1-1500 (1994)(WPD)[!].iso / 12511500 / var1481.dms / var1481.adf / Scripts / patttree.mc < prev    next >
Text File  |  1994-07-07  |  8KB  |  339 lines

  1. ; This file Copyright 1994 Dan Wesnor
  2. ;
  3. ; This file may be freely distributed as long as no 
  4. ; information is changed, no charge is made for
  5. ; the file, and the archive in which the file was
  6. ; contained is distributed in tact.  Any violation 
  7. ; of these conditions requires written authorization 
  8. ; by the copyright holder.
  9.  
  10. /*
  11.     This is a script for the Magic Camera rendering system.
  12.     Magic Camera (MC) uses ray-tracing for realisting rendering
  13.     of shadows, reflections, and transparency.  It is in the
  14.     final phase of completion and should be released shortly.
  15.     Plans are for release as shareware with a nominal charge
  16.     for a full working version.
  17.  
  18.     See comments for a description of features.
  19.     Comments are either C-style (like this one), or a semi-colon
  20.     followed by text    ; like this.
  21. */
  22.  
  23. /*
  24.     Primitive object include triangles and parallelograms,
  25.     both of which may be phong smoothed, spheres, rings (or disks),
  26.     and planes.
  27.  
  28.     Compound objects, which allow complex shapes to be built,
  29.     include extrusions, spins, skin-over-frame, filled complex
  30.     2-d polygons (with holes), heightfields, boxes, and
  31.     polygon spheres.
  32.  
  33.     Available patterns are check, wood, marble, brick,
  34.     several types of bitmap wraps, blotch, and clouds.
  35.  
  36.     Textures include waves and several type of bumpmaps.
  37.  
  38.     Lamps include point-source, directional, directional
  39.     spotlights (w/ beam width and beam falloff sharpness
  40.     controls), or spherical extended.
  41.  
  42.     Variables, which may be used in complex expressions, include
  43.     real numbers, integers, 3d-vectors, and arrays of reals, 2-d vectors,
  44.     and 3-d vectors.  Variables and arrays may be used to facilitate
  45.     animation.
  46. */
  47.  
  48. /*
  49.     This file shows how complex patterns can be built from simpler ones.
  50.  
  51.     The pattern tree looks like:
  52.  
  53.     main_patt (blotch)
  54.         |
  55.         +---------- marb_check (check)
  56.         |        |
  57.         |        +--------- red_marb (marble)
  58.         |        |        |
  59.         |        |        +-------------- red (color)
  60.         |        |        |
  61.         |        |        +-------------- black (color)
  62.         |        |
  63.         |        +--------- blue_marb (marble)
  64.         |        |        |
  65.         |        |        +-------------- blue (color)
  66.         |        |        |
  67.         |        |        +-------------- black (color)
  68.         |        |
  69.         |
  70.         +---------- red_brick (brick)
  71.         |        |
  72.         |        +--------- red (color)
  73.         |        |
  74.         |        +--------- white (color)
  75.         |
  76.         +---------- green_clouds (clouds)
  77.         |        |
  78.         |        +--------- black (color)
  79.         |        |
  80.         |        +--------- green (color)
  81.         |
  82.         +---------- blue_yellow (check)
  83.         |        |
  84.         |        +--------- blue (color)
  85.         |        |
  86.         |        +--------- yellow (color)
  87.         |
  88.         +---------- wooden (wood)
  89.         |        |
  90.         |        +--------- brown (color)
  91.         |        |
  92.         |        +--------- black (color)
  93.         |
  94.         +---------- tiny_blotch (blotch)
  95.         |        |
  96.         |        +--------- red_pastelle (color)
  97.         |        |
  98.         |        +--------- green_pastelle (color)
  99.         |        |
  100.         |        +--------- blue_pastelle (color)
  101.         |        |
  102.         |        +--------- yellow_pastelle (color)
  103.         |        |
  104.         |        +--------- magenta_pastelle (color)
  105.         |        |
  106.         |        +--------- cyan_pastelle (color)
  107.         |
  108.         +---------- wrap (wrapcylinder)
  109.         |        |
  110.         |        +--------- white (color)
  111.         |
  112.         +---------- white_marble (marble)
  113.                 |
  114.                 +--------- white (color)
  115.                 |
  116.                 +--------- black (color)
  117.  
  118. */
  119.  
  120.  
  121. camera {    ; the camera definition
  122.     loc    <10, 1.5, 5>
  123.     target    <0, 0, 0>
  124.     hfov    18        ; zoom in on the box
  125. }
  126.  
  127. lamp {
  128.     loc    <6, 11, 2>    ; simple point source lamp
  129. }
  130.  
  131. /*
  132.     these are very basic, simple color definitions
  133. */
  134.  
  135. color black { diff <0, 0, 0> }
  136. color white { diff <1, 1, 1> }
  137. color red { diff <1, 0, 0> }
  138. color green { diff <0, 1, 0> }
  139. color blue { diff <0, 0, 1> }
  140. color yellow { diff <1, 1, 0> }
  141. color magenta { diff <1, 0, 1> }
  142. color cyan { diff <0, 1, 1> }
  143. color brown { diff <.5, .3, 0> }
  144.  
  145. color red_pastelle { diff <1, .5, .5> }
  146. color green_pastelle { diff <.5, 1, .5> }
  147. color blue_pastelle { diff <.5, .5, 1> }
  148. color yellow_pastelle { diff <1, 1, .5> }
  149. color magenta_pastelle { diff <1, .5, 1> }
  150. color cyan_pastelle { diff <.5, 1, 1> }
  151.  
  152. /* 
  153.     an easy blotch pattern using the pastelles above.
  154.     a blotch pattern is a semi-interesting conglomeration
  155.     of other patterns.
  156. */
  157.  
  158. blotch tiny_blotch {
  159.     patt    red_pastelle
  160.     patt    green_pastelle
  161.     patt    blue_pastelle
  162.     patt    yellow_pastelle
  163.     patt    magenta_pastelle
  164.     patt    cyan_pastelle
  165.     scale    15
  166. }
  167.  
  168. /*
  169.     wood.  fairly simple, brown with black "rings".
  170.     change the scale to 80 and see how it affects the final image.
  171.     the rings should appear smaller and closer together.
  172. */
  173.  
  174. wood wooden {
  175.     patt    brown
  176.     grain    black
  177.     scale    40
  178. }
  179.  
  180. /* 
  181.    a cylinder wrap.  note the distortion between the edges and center of the cube...
  182.    the image is wider at the edges than in the center.  this is because wrapcy
  183.    uses a cylinder as an intermediate surface for the transformation.  since a 
  184.    cylinder cannot be wrapped around a cube perfectly, it must be "stretched"
  185.    in some areas in order to fit
  186.  
  187.    for fun, change this to a spherical wrap (wrapsy).  note how the image now becomes
  188.    distorted near the top and bottom of the cube also.  you'll have to change
  189.    "height" into "yrep".  try a value of 8 for "yrep".
  190. */
  191.  
  192. iff "mapfiles/n7" n7.map    ; load in an iff file as a bitmap
  193.  
  194. wrapcy wrap {
  195.     bitmap    n7.map        ; use the bitmap loaded above
  196.     xrep    16        ; the pattern repeats 16 time horizontally around the
  197.                 ; cylinder
  198.     height    .5        ; and repeats every 0.5 units (starting at 0.0) in
  199.                 ; the vertical direction
  200.     patt    white        ; this pattern is the one actually used.  it is altered
  201.                 ; by the bitmap image
  202.     dodiff            ; "dodiff" specifies that the diffuse part of the 
  203.                 ; "white" pattern (from above) is to be altered
  204.                 ; "dotrans" and/or "dorefl" could also have been used
  205. }
  206.  
  207. /*
  208.     marble.  again, fairly simple.  note than any colors could have been used,
  209.     not just black and white.  go ahead, change them, and see what happens
  210. */
  211.  
  212. marble white_marble {
  213.     patt    white
  214.     grain    black
  215.     scale    3
  216. }
  217.  
  218. /*
  219.     checkerboard pattern.  note that if "blue" and "yellow" are swapped, 
  220.     their positions in the checkerboard will also swap.
  221. */
  222.  
  223. check blue_yellow {
  224.     patt1    blue
  225.     patt2    yellow
  226.     xsize    .5
  227.     ysize    .5
  228.     zsize    .5
  229. }
  230.  
  231. /*
  232.     bricks.  again, any colors can be used
  233. */
  234.  
  235. brick red_brick {
  236.     brick    red
  237.     mortar    white
  238.     xsize    .25
  239.     ysize    .25
  240.     zsize    .5
  241.     msize    .05
  242.     yoffset    .25
  243.     zoffset    .25
  244. }    
  245.  
  246. /*
  247.     clouds... but green on black.  versatile, huh!  change the power to 
  248.     see how it changes the pattern.
  249. */
  250.  
  251. clouds green_clouds {
  252.     sky    black
  253.     clouds    green
  254.     scale    3
  255.     power    .5
  256. }
  257.  
  258. /*
  259.     these two marbles are used in the next checker board.  the pattern tree 
  260.     can be a deep as your memory will allow.  try putting "green_clouds"
  261.     (or any other pattern from above) in place of "red", "black", or "blue"
  262.     below.  then change "green" or black" in "green_clouds" to "wood" (or any
  263.     other surface from above).  neat, huh!
  264.  
  265.     also, try changing the scale on only one of the two marbles.  the grains
  266.     will no longer match up, making it appears as though the red and blue
  267.     checks are from different blocks of marble.
  268. */
  269.  
  270. marble red_marb {
  271.     patt    red
  272.     grain    black
  273.     scale    8
  274. }
  275.  
  276. marble blue_marb {
  277.     patt    blue
  278.     grain    black
  279.     scale    8
  280. }
  281.  
  282. /*
  283.     ties "red_marb" and "blue_marb" together.
  284. */
  285.  
  286. check marb_check {
  287.     patt1    red_marb
  288.     patt2    blue_marb
  289.     xsize    .2
  290.     ysize    .2
  291.     zsize    .2
  292. }
  293.  
  294. /* 
  295.     ties all of the patterns together.  try moving lines around
  296.     (put red_brick first, for example).  the patterns will move into
  297.     different places accordingly (the first pattern always appears in 
  298.     the same place in the blotch).
  299. */
  300.  
  301.  
  302. blotch main_patt {
  303.     patt    marb_check
  304.     patt    red_brick
  305.     patt    green_clouds
  306.     patt    blue_yellow
  307.     patt    wooden
  308.     patt    tiny_blotch
  309.     patt    wrap
  310.     patt    white_marble
  311.     scale    3
  312. }
  313.  
  314. /*
  315.     the box command builds a box out of six parallelograms.
  316.     v1, v2, and v3, define the location of 3 vertices relative
  317.     to loc.  the other 4 vertices are loc+v1+v2, loc+v1+v3,
  318.     loc+v2+v3, and loc+v1+v2+v3.  if v1, v2, and v3 are not
  319.     orthoganol, then the box will be slanted or skewed.
  320. */
  321.  
  322. box {
  323.     patt    main_patt
  324.     loc    <-1, -1, -1>
  325.     v1    <2, 0, 0>
  326.     v2    <0, 2, 0>
  327.     v3    <0, 0, 2>
  328.     origin    <.01, .01, .01>    ; origin redefines the origin of
  329.                 ; pattern space as it is applied to the
  330.                 ; object, so that by changing the origin,
  331.                 ; patterns can be forced to "move around"
  332.                 ; on the object.  this allows objects
  333.                 ; using the same pattern to look 
  334.                 ; different by placing them in different
  335.                 ; areas of pattern space
  336. }
  337.  
  338.  
  339.